]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
St: fix container paint volumes
authorDan Winship <danw@gnome.org>
Mon, 1 Aug 2011 19:16:45 +0000 (15:16 -0400)
committerDan Winship <danw@gnome.org>
Wed, 3 Aug 2011 13:16:55 +0000 (09:16 -0400)
If a container is not clip-to-allocation, then its get_paint_volume()
needs to include the paint volumes of all of its children, since they
(or their children) may paint outside the container's allocation.

Also, if the superclass get_paint_volume() returns FALSE, then the
subclass should return FALSE too.

https://bugzilla.gnome.org/show_bug.cgi?id=655812

src/shell-generic-container.c
src/st/st-box-layout.c
src/st/st-container.c
src/st/st-group.c

index c54ebf2785294efbab1e7782986848e00a383ae6..479cd056bd85631f32841678d99109e56b23428e 100644 (file)
@@ -247,34 +247,6 @@ shell_generic_container_finalize (GObject *object)
   G_OBJECT_CLASS (shell_generic_container_parent_class)->finalize (object);
 }
 
-/* Based on implementation from clutter-group.c */
-static gboolean
-shell_generic_container_get_paint_volume (ClutterActor *actor,
-                                          ClutterPaintVolume *volume)
-{
-  GList *l, *children;
-
-  children = st_container_get_children_list (ST_CONTAINER (actor));
-
-  CLUTTER_ACTOR_CLASS (shell_generic_container_parent_class)->get_paint_volume (actor, volume);
-
-  for (l = children; l != NULL; l = l->next)
-    {
-      ClutterActor *child = l->data;
-      const ClutterPaintVolume *child_volume;
-
-      /* This gets the paint volume of the child transformed into the
-       * group's coordinate space... */
-      child_volume = clutter_actor_get_transformed_paint_volume (child, actor);
-      if (!child_volume)
-        return FALSE;
-
-      clutter_paint_volume_union (volume, child_volume);
-    }
-
-  return TRUE;
-}
-
 static void
 shell_generic_container_class_init (ShellGenericContainerClass *klass)
 {
@@ -287,7 +259,6 @@ shell_generic_container_class_init (ShellGenericContainerClass *klass)
   actor_class->get_preferred_width = shell_generic_container_get_preferred_width;
   actor_class->get_preferred_height = shell_generic_container_get_preferred_height;
   actor_class->allocate = shell_generic_container_allocate;
-  actor_class->get_paint_volume = shell_generic_container_get_paint_volume;
   actor_class->paint = shell_generic_container_paint;
   actor_class->pick = shell_generic_container_pick;
 
index 0aa5ef2e8f4ebf5cfed6b84d2b64c40cfe5be2fb..e0b6043566c4aa792edd280be4dbb0289a15baa6 100644 (file)
@@ -1020,7 +1020,8 @@ st_box_layout_get_paint_volume (ClutterActor       *actor,
   StBoxLayout *self = ST_BOX_LAYOUT (actor);
   gdouble x, y;
 
-  CLUTTER_ACTOR_CLASS (st_box_layout_parent_class)->get_paint_volume (actor, volume);
+  if (!CLUTTER_ACTOR_CLASS (st_box_layout_parent_class)->get_paint_volume (actor, volume))
+    return FALSE;
 
   /* When scrolled, st_box_layout_apply_transform() includes the scroll offset
    * and affects paint volumes. This is right for our children, but our paint volume
index 6283bd7003b64c32dcc74e562c99c1ec3b678d2d..c2494079c45553b67d275077a4f5deaccb47ffcd 100644 (file)
@@ -427,6 +427,37 @@ st_container_dispose (GObject *object)
   G_OBJECT_CLASS (st_container_parent_class)->dispose (object);
 }
 
+static gboolean
+st_container_get_paint_volume (ClutterActor *actor,
+                               ClutterPaintVolume *volume)
+{
+  StContainerPrivate *priv = ST_CONTAINER (actor)->priv;
+  GList *l;
+
+  if (!CLUTTER_ACTOR_CLASS (st_container_parent_class)->get_paint_volume (actor, volume))
+    return FALSE;
+
+  if (!clutter_actor_get_clip_to_allocation (actor))
+    {
+      /* Based on ClutterGroup/ClutterBox; include the children's
+       * paint volumes, since they may paint outside our allocation.
+       */
+      for (l = priv->children; l != NULL; l = l->next)
+        {
+          ClutterActor *child = l->data;
+          const ClutterPaintVolume *child_volume;
+
+          child_volume = clutter_actor_get_transformed_paint_volume (child, actor);
+          if (!child_volume)
+            return FALSE;
+
+          clutter_paint_volume_union (volume, child_volume);
+        }
+    }
+
+  return TRUE;
+}
+
 /* filter @children to contain only only actors that overlap @rbox
  * when moving in @direction. (Assuming no transformations.)
  */
@@ -719,6 +750,7 @@ static void
 st_container_class_init (StContainerClass *klass)
 {
   GObjectClass *object_class = G_OBJECT_CLASS (klass);
+  ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass);
   StWidgetClass *widget_class = ST_WIDGET_CLASS (klass);
   StContainerClass *container_class = ST_CONTAINER_CLASS (klass);
 
@@ -726,6 +758,8 @@ st_container_class_init (StContainerClass *klass)
 
   object_class->dispose = st_container_dispose;
 
+  actor_class->get_paint_volume = st_container_get_paint_volume;
+
   widget_class->navigate_focus = st_container_navigate_focus;
 
   container_class->get_focus_chain = st_container_real_get_focus_chain;
index 502957b03dea731c1f64f28caa3a7beeaad223bb..1395af211bc7fe64c811f6c325eddf94a4e176ef 100644 (file)
@@ -231,34 +231,6 @@ st_group_hide_all (ClutterActor *actor)
                              NULL);
 }
 
-/* Based on implementation from clutter-group.c */
-static gboolean
-st_group_get_paint_volume (ClutterActor *actor,
-                            ClutterPaintVolume *volume)
-{
-  GList *l, *children;
-
-  children = st_container_get_children_list (ST_CONTAINER (actor));
-
-  CLUTTER_ACTOR_CLASS (st_group_parent_class)->get_paint_volume (actor, volume);
-
-  for (l = children; l != NULL; l = l->next)
-    {
-      ClutterActor *child = l->data;
-      const ClutterPaintVolume *child_volume;
-
-      /* This gets the paint volume of the child transformed into the
-       * group's coordinate space... */
-      child_volume = clutter_actor_get_transformed_paint_volume (child, actor);
-      if (!child_volume)
-        return FALSE;
-
-      clutter_paint_volume_union (volume, child_volume);
-    }
-
-  return TRUE;
-}
-
 
 static void
 st_group_class_init (StGroupClass *klass)
@@ -269,7 +241,6 @@ st_group_class_init (StGroupClass *klass)
   actor_class->get_preferred_height = st_group_get_preferred_height;
   actor_class->allocate = st_group_allocate;
   actor_class->paint = st_group_paint;
-  actor_class->get_paint_volume = st_group_get_paint_volume;
   actor_class->pick = st_group_pick;
   actor_class->show_all = st_group_show_all;
   actor_class->hide_all = st_group_hide_all;